package com.ogawa.jopai.devicemanage.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ogawa.base.utils.imageloader.ImageConfigImpl
import com.ogawa.base.utils.imageloader.ImageLoader
import com.ogawa.base.utils.printNoNull
import com.ogawa.jopai.devicemanage.bean.DeviceTypeBean
import com.ogawa.joypal.devicemanage.R

class DeviceSelectAdapter:
    BaseQuickAdapter<DeviceTypeBean, BaseViewHolder>(
        R.layout.item_select_device,
        ArrayList<DeviceTypeBean>()
    ) {
    override fun convert(helper: BaseViewHolder, item: DeviceTypeBean) {
        helper.setText(R.id.itemSelectDeviceTv, printNoNull(item.typeName))
        ImageLoader.getInstance().loadImage(mContext, ImageConfigImpl.builder()
            .url(item.imageSrc)
            .isCenterCrop(true)
            .imageView(helper.getView(R.id.itemSelectDeviceIv))
            .placeholder(R.drawable.img_chair)
            .build())
    }
}